﻿@model IEnumerable<WorkTimePrj.Models.Item>
@{
    ViewBag.Title = "项目明细";
}
<!DOCTYPE html>
<html>
<head>
    <title>项目明细</title>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <style type="text/css">
        body { color: #000000; }
        h2 { font-size: 10pt; font-family: simsun; font-weight: normal; background: #197B30; height: 35px; line-height: 35px; padding-left: 10px; color: #ffffff; }
        .WP_1 { width: 97%; margin: 15px auto; }
        .Btn01 { border: solid 1px #5381B3; color: #5381B3; }
        input[type='text'].TB01 { width: 135px; }
        table { border-collapse: collapse; margin: 15px 0; border: solid 1px #A5A5A5; }
        table tr th { background: #197B30; color: #ffffff; border-right: solid 1px #A5A5A5; border-bottom: solid 1px #A5A5A5; }
        table tr td { font-size: 12px; text-align: left; color: #000000; border-right: solid 1px #A5A5A5; border-bottom: solid 1px #A5A5A5; }
        table tr td div { border: solid 1px #c0d6ef; padding: 10px 0 0 0; background: #e4ecf5; }
        
        table tr td div ul { width: 600px; margin: auto; }
        table tr td div ul li { list-style: none; line-height: 22px; }
        table tr td div ul label { color: #440e62; }
        table tr td div ul span { color: #440e62; font-weight: bold; }
        .WP_3 { width: 600px; text-align: left; margin: 0 auto; }
        .Btn01 { border: solid 1px #5381B3; }
        .Label01 { color: #440e62; }
        .Label02 { color: #440e62; font-weight: bold; }
        .Text01 { width: 550px; }
        .WP_4 { float: left; padding-top: 5px; }
        .WP_5 { float: left; }
        .WP_6 { float: left; background: #440E62; color: #ffffff; margin-left: 5px; width: 15px; height: 15px; line-height: 15px; text-align: center; }
        .WP_7 { display: block; border: solid 1px #c0d6ef; background: #e4ecf5; margin-top: 15px; float: left; }
    </style>
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/DatePicker/WdatePicker.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            //             $('#BtnSubmit').click(function () {
            //                 var date1 = new Date();
            //                 date1.setFullYear($dp.$D('TBStartTime').y, $dp.$D('TBStartTime').M - 1, $dp.$D('TBStartTime').d);
            //                 var dayofwk1 = date1.getDay();
            //                 var date2 = new Date();
            //                 date2.setFullYear($dp.$D('TBEndTime').y, $dp.$D('TBEndTime').M - 1, $dp.$D('TBEndTime').d);
            //                 var dayofwk2 = date2.getDay();
            //                 //debugger
            //                 if (dayofwk1 != 1 || dayofwk2 != 0) {
            //                     alert('日期选择错误！');
            //                     return false;
            //                 }
            //                 return true;
            //             });
            if (window.addEventListener) {
                //其它浏览器的事件代码: Mozilla, Netscape, Firefox
                //添加的事件的顺序即执行顺序 //注意用 addEventListener 添加带on的事件，不用加on 
                $('#BtnSubmit')[0].addEventListener('click', valDate, false);
            }
            else {
                //IE 的事件代码 在原先事件上添加 add 方法
                $('#BtnSubmit')[0].attachEvent('onclick', valDate);
            }
            $('#BtnSubmit').click(function () {
                //debugger
                var startTime = $('#TBStartTime').val();
                var endTime = $('#TBEndTime').val();
                var account = $('#ddlUser').val();
                var pid = $('#ddlProject').val();
                window.open('ListProject?startTime=' + startTime + '&endTime=' + endTime + '&account=' + account + '&pid=' + pid)
            });
        });
        function valDate() {
            var date1 = new Date();
            date1.setFullYear($dp.$D('TBStartTime').y, $dp.$D('TBStartTime').M - 1, $dp.$D('TBStartTime').d);
            var dayofwk1 = date1.getDay();
            var date2 = new Date();
            date2.setFullYear($dp.$D('TBEndTime').y, $dp.$D('TBEndTime').M - 1, $dp.$D('TBEndTime').d);
            var dayofwk2 = date2.getDay();
            //debugger
            if (dayofwk1 != 1 || dayofwk2 != 0) {
                alert('日期选择错误！');
                return false;
            }
            else {
                return true;
            }
        }
        function pickedFunc1() {
            var dayofwk = $dp.cal.getP('w');
            if (dayofwk != '01')
                alert('日期错误！只能选择星期一');
        }
        function pickedFunc2() {
            var dayofwk = $dp.cal.getP('w');
            if (dayofwk != '00')
                alert('日期错误！只能选择星期日');
        }
    </script>
</head>
<body>
    @using (Html.BeginForm())
    {
        <div class="WP_1">
            <h2>
                项目工作量统计 &nbsp;&nbsp;&nbsp;<span class="Lbl02">@ViewBag.startTime</span> 至 <span class="Lbl02">@ViewBag.endTime</span>&nbsp;&nbsp;&nbsp;
                总计 @ViewBag.cnt 条</h2>
            <div>
                <label class="Lbl01">
                    开始时间</label>&nbsp;&nbsp;&nbsp;<input id="TBStartTime" name="TBStartTime"  class="TB01" type="text" value="@ViewBag.startTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:pickedFunc1})"/>
                <label class="Lbl01">
                    结束时间</label>&nbsp;&nbsp;&nbsp;<input id="TBEndTime"  name="TBEndTime" class="TB01" type="text" value="@ViewBag.endTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:pickedFunc2})"/>
                <label class="Lbl01">
                    用户</label>
                @Html.DropDownList("userSelectList", null, "---", new { @class = "Select", id = "ddlUser" })
                <label class="Lbl01">
                    项目</label>
                @Html.DropDownList("projectSelectList", null, "---", new { @class = "Select", id = "ddlProject" })
                <input id="BtnSubmit" type="submit" class="Btn01" value="查询" />
            </div>
            @if (ViewBag.cnt != 0)
            {
                <table border="1">
                    @{int i = 0;
                      foreach (var item in Model)
                      {
                          i = i + 1;
                        <tr>
                            <td>
                                <div>
                                    <span class="WP_6">@i</span>
                                    <ul>
                                        <li><span>[@Html.DisplayFor(modelItem => item.Project.code)] @Html.DisplayFor(modelItem => item.Project.display)</span>
                                        </li>
                                        <li>员工姓名：
                                            @Html.DisplayFor(modelItem => item.User_DisplayName)
                                            &nbsp;&nbsp;&nbsp; 时间段：
                                            @Html.DisplayFor(modelItem => item.worktime)
                                            &nbsp;&nbsp;&nbsp; 工作量：
                                            @Html.DisplayFor(modelItem => item.cost)H </li>
                                        <li>单项内容：
                                            @Html.DisplayFor(modelItem => item.title)
                                        </li>
                                        <li>确认状态：
                                            @if (item.ack != null)
                                            { 
                                                @Html.DisplayFor(modelItem => item.ack_type)
                                            }
                                            else
                                            {
                                                <span style="color: Red;">未确认 </span>
                                            }
                                        </li>
                                    </ul>
                                </div>
                            </td>
                        </tr>
                      }
                    }
                </table>
            }
            else
            {
                <span class="WP_7">无统计数据</span>
            }
        </div>
    }
</body>
</html>
